package com.csu.backmanagesys.Mapper;

import com.csu.backmanagesys.Domain.Account;
import com.csu.backmanagesys.Domain.Category;
import com.csu.backmanagesys.Domain.Item;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface ItemMapper {

    List<Item> selectItem();

    @Transactional
    List<Item> selectItemById(String itemId);

    List<Item> fuzzySelectItem(String param);

    void insertItem(
            String itemid,
            String productid,
            BigDecimal listprice,
            BigDecimal unitcost,
            int supplier,
            String status,
            String attr1,
            String attr2,
            String attr3,
            String attr4,
            String attr5
    );

    @Transactional
    void insertInventory(
      String itemid,
      int qty
    );

    void deleteItem(
            String itemId
    );

    void updateItem(
            @Param("itemid") String itemid,
            @Param("productid") String productid,
            @Param("listprice") BigDecimal listprice,
            @Param("unitcost") BigDecimal unitcost,
            @Param("supplier") int supplier,
            @Param("status") String status,
            @Param("attr1") String attr1,
            @Param("attr2") String attr2,
            @Param("attr3") String attr3,
            @Param("attr4") String attr4,
            @Param("attr5") String attr5
    );

    @Transactional
    void updateItemQty(
      @Param("itemId") String itemId,
      @Param("stockCount") int stockCount
    );
}
